<template>
  <view> </view>
</template>
<script setup>
// import { onLoad } from "@dcloudio/uni-app";
import { onMounted, ref } from "vue";
import { getLandingScene, getWebPageUrl } from "@/services/utils";

const src = ref("");
onMounted(async (options) => {
  switch (true) {
    case [1011, 1012, 1013, 1047, 1048, 1049, 1124, 1125, 1126, 1089, 1017].includes(
      uni.getLaunchOptionsSync().scene
    ) && uni.getLaunchOptionsSync().query.hasOwnProperty("scene"):
      const qrUrl = decodeURIComponent(uni.getLaunchOptionsSync().query.scene);
      const res = await getLandingScene(qrUrl);
      if (res?.code === 200) {
        console.log(res.data.fullUri);
        uni.redirectTo({ url: res.data.fullUri });
      }
      break;

    case uni.getLaunchOptionsSync().query.hasOwnProperty("pageId"):
      const webUrl = await getWebPageUrl(
        uni.getLaunchOptionsSync().query.pageId
      );
      if (webUrl?.code === 200) {
        uni.reLaunch({
          url: "/pages/webView/webview?webSrc=" + webUrl.data,
        });
      }
      break;

    default:
      break;
  }
});
</script>

<style></style>
